/**
 * Copyright (c) 2009 Teoti Graphix, LLC See:
 *     http://tkarchitecture.teotigraphix.org
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 * @author Michael Schmalle mschmalle@teotigraphix.com
 */
package org.teotigraphix.dx.interfaces
{

/**
 * The factory a toolkit component uses for the <code>ToolKitManager</code>
 * to create it's instances.
 * 
 * <p>The factory can be responsible for creating the;</p>
 * <ul>
 * <li><code>coreModel</code></li>
 * <li><code>coreSkin</code></li>
 * <li><code>coreBehavior</code></li>
 * <li><code>modelLayer</code></li>
 * <li><code>skinLayer</code></li>
 * <li><code>behaviorLayer</code></li>
 * <li>Any additional components a subclass might implement.</li>
 * </ul>
 * 
 * <p>If the factory implements the static <code>getInstance()</code> method,
 * there will only be one instance created and the ToolKitManager will use
 * that instance when creating the toolkit elements.</p>
 * 
 * @copyright Teoti Graphix, LLC
 * @author Michael Schmalle
 * @date 07-08-09
 * 
 * @see org.teotigraphix.dx.patterns.manager.ToolKitManager
 * @see org.teotigraphix.dx.patterns.manager.ToolKitManager#validateInitialization()
 * @see org.teotigraphix.dx.patterns.manager.ToolKitManager#validateInitializationComplete()
 */
public interface IToolKitFactory
{
	//--------------------------------------------------------------------------
	//
	//  Methods
	//
	//--------------------------------------------------------------------------
	
	/**
	 * Creates and returns the <code>coreSkin</code>.
	 */
	function createCoreSkin():IComponentSkinCore;
	
	/**
	 * Creates and returns the <code>coreBehavior</code>.
	 */
	function createCoreBehavior():IComponentBehaviorCore;
	
	/**
	 * Creates and returns the <code>coreModel</code>.
	 */
	function createCoreModel():IComponentModelCore;	
	
	/**
	 * Creates and returns the component's <code>modelLayer</code>.
	 */	
	function createModelLayer():IModelLayer;
	
	/**
	 * Creates and returns the component's <code>skinLayer</code>.
	 */	
	function createSkinLayer():ISkinLayer;
	
	/**
	 * Creates and returns the component's <code>behaviorLayer</code>.
	 */	
	function createBehaviorLayer():IBehaviorLayer;
	
	/**
	 * Creates subcomponents of the Component that a subclass of this
	 * factory understands and has contracted with the Component.
	 * 
	 * <p>Called by the framework during 
	 * <code>ToolKitManager.validateInitializationComplete()</code> method
	 * and before the <code>tollKitInitialized</code> is set true.</p>
	 * 
	 * <p>In the default framework component and container, this 
	 * <code>IToolKitFactory</code> method is called during the component's 
	 * <code>initializationComplete()</code> method right after 
	 * <code>addChild()</code> and <code>createChildren()</code> have run.</p>
	 * 
	 * @param client The initializing toolkit component.
	 */
	function createComponents(client:IToolKitComponent):void;
}
}